package cn.tpshion.config.support;

import cn.tpshion.config.common.AuthType;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 认证配置信息
 */
@ConfigurationProperties("config.auth")
@Component
public class AuthProperties {

    /**
     * 认证方式:
     * 1、password 密码模式，需要配置用户名和密码
     * 2、code 授权码模式，自定义授权码
     * 默认password
     */
    private String type = AuthType.PASSWORD.getType();

    /**
     * 用户名
     */
    private String username = "admin";

    /**
     * 密码
     */
    private String password = "admin";

    /**
     * 授权码
     */
    private String secretkey;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSecretkey() {
        return secretkey;
    }

    public void setSecretkey(String secretkey) {
        this.secretkey = secretkey;
    }

    @Override
    public String toString() {
        return "AuthProperties{" +
                "type='" + type + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", secretkey='" + secretkey + '\'' +
                '}';
    }
}
